/**
 *<p> Copyright © 2018 Inspur Group Co.,Ltd.  版权所有 浪潮集团有限公司 </p>.
 */
package com.inspur.cdc.server.license.api.sdk.consts;

import java.util.HashMap;
import java.util.Map;
import java.lang.Integer;

/**
 * @ClassName: LicenseConsts
 * @Description: License常量类
 *
 * @author: tianlin
 * @date: 2019年5月27日 下午4:13:03
 */
public class LicenseConsts {

    /** @Fields TYPE_TRIAL: 试用版标识  */
    public static final String TYPE_TRIAL = "T";

    /** @Fields TYPE_TRIAL: 试用版延长时间标识  */
    public static final String TYPE_TRIAL_ADD = "E";

    /** @Fields TYPE_STANDARD: 标准版标识  */
    public static final String TYPE_STANDARD = "A";

    /** @Fields TYPE_ENTERPRISE: 企业版标识  */
    public static final String TYPE_ENTERPRISE = "B";
    
    /** 企业版，使用期限为一年*/
    public static final String TYPE_ENTERPRISE_TRIAL = "TB";

    /** 标准版，使用期限为一年*/
    public static final String TYPE_STANDARD_TRIAL = "TA";

    /** 标准版升级， 将标准升级为企业*/
    public static final String TYPE_STANDARD_TO_ENTERPRISE = "UA2B";

    /** 试用版无时间时级别为None */
    public static final String TYPE_NONE = "None";

    /** 试用版延长次数限制 */
    public static final int TYPE_TRIAL_ADD_LIMIT = 1;


    /** 添加的资产消耗了序列号 */
    public static final int CONSUME_LICENSE = 0;

    /** 添加的资产没有消耗序列号 */
    public static final int NO_CONSUME_LICENSE = 1;

    /** 序列号节点数目限制 */
    public static final int ONE_THOUSAND_LIMIT = 1000;

    /** 版本类型是否存在 */
    public static boolean includeType(String type) {
        return (TYPE_TRIAL.equals(type) ||
                TYPE_TRIAL_ADD.equals(type) ||
                TYPE_STANDARD.equals(type) ||
                TYPE_ENTERPRISE.equals(type) ||
                TYPE_ENTERPRISE_TRIAL.equals(type) ||
                TYPE_STANDARD_TRIAL.equals(type) ||
                TYPE_STANDARD_TO_ENTERPRISE.equals(type));
    }

    /** 版本权限配置Map
     *  value.suString(0, 2) 2位, 激活权重, 按照大小决定是否可以激活
     *  value.suString(2, 4) 2位, 时间权重, 按照大小决定是否采用激活码中时间
     *  value.suString(4, 7) 3位, 时间位, 单位天, 使用时需要转换为小时与数据库对应
     *
     *  add at 20210202 判断激活后, 前端页面权限是否下降
     *  value.suString(7, 8) 1位, 页面权重, 按照大小决定是否需要删除资源
     * */
    public static final Map<String, String> licenseWeightConfigMap = new HashMap<String, String>() {
        {
            put("None", "00000000");
            put("T", "10000902");
            put("TA", "20103651");
            put("TB", "30103652");
            put("A", "40200001");
            put("B", "50200002");
        }
    };

    /** 序列号能否激活标志 */
    public static final String FLAG_CAN_NOT_ACTIVATE = "-1";
    public static final String FLAG_FIRST_ACTIVATE = "0";
    public static final String FLAG_ADD_ACTIVATE = "1";
    public static final String FLAG_UPGRADE_ACTIVATE = "2";
    public static final String FLAG_SPECIAL_ACTIVATE = "3";

    // 自身网管告警ID,与iosp的定义的值保持一致
    public static final String PIM_SELF_RESOURCE_ID = "72534b7f68054f3c98e63RbT";

    public static final String TRAIL_TIME_EXPIRE="0x02010A010002";

    public static final String SERIAL_NUMBER_USE="0x02010A010003";

    public static final String START_SERVICE_COMMAND ="sh /home/ispim/manservice.sh active";

    public static final String STOP_SERVICE_COMMAND ="sh /home/ispim/manservice.sh mask";

}
